#include <kwdb/client.h>
#include <iostream>
#include <chrono>

int main() {
    kwdb::IngestConfig config;
    config.ingest_endpoint = "127.0.0.1:9090";
    config.timeout_ms = 5000;

    kwdb::KwdbClient client(config);

    // Test single point write
    kwdb::Point point("sensor_data");

    // Add tags
    point.add_tag("device_id", "sensor-001");
    point.add_tag("location", "building-A");

    // Add fields
    point.add_field("temperature", 23.5);
    point.add_field("humidity", 65.0);
    point.add_field("pressure", 1013.25);

    // Use current time
    point.timestamp(std::chrono::system_clock::now());

    auto status = client.write(point);
    if (status.ok()) {
        std::cout << "Single point written successfully!" << std::endl;
        return 0;
    } else {
        std::cout << "Write failed: " << status.message << std::endl;
        return 1;
    }
}